package com.thon.service.system.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thon.dao.system.RolesAuthorityDao;
import com.thon.dao.util.Page;
import com.thon.entity.system.RolesAuthority;
import com.thon.service.system.RolesAuthorityService;

@Service
@Transactional
public class RolesAuthorityServiceImpl implements RolesAuthorityService {

	@Autowired
	private RolesAuthorityDao rolesAuthorityDao;	


	@Override
	public RolesAuthority read(Integer id) {		
		
	    return rolesAuthorityDao.get(id);
	}

	@Override
	public String create(RolesAuthority RolesAuthority) {
		String msg = "success";		
		rolesAuthorityDao.save(RolesAuthority);
		return msg;
	}

	@Override
	public String delete(Integer id) {
		String msg = "success";		
		rolesAuthorityDao.delete(id);
		return msg;
	}

	@Override
	public String update(RolesAuthority RolesAuthority) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<RolesAuthority> readList() {
	
			return rolesAuthorityDao.readList();
	
	}

	@Override
	public Page<RolesAuthority> readListPage(Integer pageNo, Integer pageSize) {
		Page<RolesAuthority> page = new Page<RolesAuthority>();
		page.setPageNo(pageNo);
		page.setPageSize(pageSize);
		page.desc("sort");
		return rolesAuthorityDao.readListPage(page);
	}

	@Override
	public List<RolesAuthority> getRolesAuthority(String by, String val) {
		
		return rolesAuthorityDao.readList(by,val);
	}

	@Override
	public List<RolesAuthority> getRolesAuthority(String by, Integer val) {
		
		return rolesAuthorityDao.readList(by,val);
	}
	


}